package org.mysfit.ctp4j.core.service.impl;

import java.util.List;

import org.mysfit.ctp4j.core.service.PloyService;
import org.mysfit.ctp4j.infra.entity.SkData;
import org.mysfit.ctp4j.infra.enums.PolyEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 
 * @author long.gf
 * @since 2022-12-06
 *
 */
@Service
public class PloyServiceImpl implements PloyService {

	@Autowired
	private PloyHelper helper;
	
	@Override
	public String checkPolyKC(SkData sk) {
 		List<PolyEnum> polyList = PolyEnum.getEffectuveList();
		for (PolyEnum polyEnum : polyList) {
			if("POLY_A".equals(polyEnum.getPolyNo())) {
				int dkFlag = helper.checkPolyAK(sk);
				if(dkFlag != 0) {
					return polyEnum.getPolyNo() +"," +dkFlag;
				}
			}
		}
		return "";
	}

	@Override
	public String checkPolyPC(SkData sk) {
		List<PolyEnum> polyList = PolyEnum.getEffectuveList();
		for (PolyEnum polyEnum : polyList) {
			if("POLY_A".equals(polyEnum.getPolyNo())) {
				int dkFlag = helper.checkPolyAP(sk);
				if(dkFlag != 0) {
					return polyEnum.getPolyNo() +"," +dkFlag;
				}
			}
		}
		return "";
	}
	
	
}
